/**
 * Created by liushan on 2017/4/18.
 */
const Util = {}

/*json数据合并*/
Util.mergeJSONData = function(params,defaults){
  params = params || {};
  for(const def in defaults){
    if (typeof params[def] === 'undefined') {
      params[def] = defaults[def];
    }
    else if (typeof params[def] === 'object') {
      for (const deepDef in defaults[def]) {
        if (typeof params[def][deepDef] === 'undefined') {
          params[def][deepDef] = defaults[def][deepDef];
        }
      }
    }
  }
  return params;
}






module.exports = Util;
